Occurs before the folder selection dialog is shown to the user to select a destination folder for a project copy. This event does not occur in Web Access.
Syntax
ProjectWorkflowEvent_InitializeExpandItem (SubItems)
Name | Description |
---|---|
SubItems |
A variant array with an item for each subfolder of the folder to be expanded. Each element is a variant array with the following elements:
Your implementation of this event should set the constants in the third element above to meet your requirements. |
Remarks
This event and the ProjectWorkflowEvent_InitializeExpandItem and ProjectWorkflowEvent_PrepareBrowser events can be used to restrict the destination project folder selected by a user:
After the event, all of the subfolders of the current folder are handled as indicated by the constants in the updated SubItems array. If an item does not occur in the SubItems array, the AS_PRJITEM_MODE_NONE constant is assumed.
Example
Following are example implementations of this event and the ProjectWorkflowEvent_InitializeExpandItem event:
'Rules for this example:
'1. Only 2nd level folders can be selected
'2. A folder is shown only when it is open and the current user's name is on the list of users ' stored in the CreatePCUsers property that are allowed to create a project copy.
'3. Subfolders are not shown
Function ProjectWorkflowEvent_InitializeExpandItem(ItemProperties)
lLevel = UBound (Split (Folder.Path, "\"))
Select Case lLevel
Case 2
ItemProperties = Array ("ProjectControl.Open", "ProjectControl.CreatePCUsers")
End Select
End Function
Function ProjectWorkflowEvent_BeforeExpandItem(SubItems)
lLevel = UBound (Split (Folder.Path, "\"))
Select Case lLevel
Case 0 'Root folders
For i = LBound (SubItems) To UBound (SubItems)
If Right (SubItems (1, i), 7) = "Projects" Then
SubItems (i)(2) = AS_PRJITEM_MODE_VISIBLE + AS_PRJITEM_MODE_EXPANDABLE 'Show it
Else
SubItems (i)(2) = AS_PRJITEM_MODE_NONE 'Hide it
End If
Next
Case 1 'Work Units
For i = LBound (SubItems) To UBound (SubItems)
SubItems (i)(2) = AS_PRJITEM_MODE_VISIBLE + AS_PRJITEM_MODE_EXPANDABLE
Next
Case 2 'Splits
For i = LBound (SubItems) To UBound (SubItems)
If SubItems (i)(3) And InStr (User.Name & ";", SubItems (i)(4)) > 0 Then
'The split is available, the user can choose it
SubItems (i)(2) = AS_PRJITEM_MODE_VISIBLE + AS_PRJITEM_MODE_SELECTABLE
Else
SubItems (i)(2) = AS_PRJITEM_MODE_NONE 'Hide it
End If
Next
Case Else
'Cannot happen since everything at level 2 is not selectable
End Select
End Function
Related concepts
About the project workflow events
Related information
ProjectWorkflowEvent_*ChangeManager events
ProjectWorkflowEvent_*ExecuteTransition events
ProjectWorkflowEvent_*Reroute events
ProjectWorkflowEvent_InitializeExpandItem event
ProjectWorkflowEvent_InitializeWizard event